<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="_LANGUAGE" xml:lang="_LANGUAGE">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Simple Jquery CSS Tabs and V3 Google Maps</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" language="javascript">
        <!--
            $(document).ready(function() {
                //Default Action
                $(".tab_content").hide();
                $("ul.tabs li:first").addClass("active").show();
                $(".tab_content:first").show();

                //On Click Event
                $("ul.tabs li").click(function() {
                    $("ul.tabs li").removeClass("active");
                    $(this).addClass("active");
                    $(".tab_content").hide();
                    var activeTab = $(this).find("a").attr("href");
                    $(activeTab).fadeIn();
                    if (activeTab == '#tab2') {
                        $(window).resize(function() {
                            //$("#tab2").css({'display':'block'});
                            //$("#map_canvas").css({'width':'630px', 'height':'400px'});
                            //initialize();
                            //alert('Changed!');
                        });
                    }
                    return false;
                });
            });
            -- ></script>

        <style type="text/css" media="screen">
            <!--
            /* Standard definitions  */
            body{font:normal 76.1% "Trebuchet MS", Arial, Helvetica, sans-serif;color:#151515;background:#eaeaea;margin:20px;}
            h1{font-size:2.2em;margin:20px 0;}
            a:link,a:active,a:visited{background-color:transparent;color:#7aa200;}
            a:hover{background-color:transparent;color:#a22600;}
            /* Extras  */
            .backtohome{border:1px solid #dbdbdb;background-color:#f5f5f5;color:#8f8f8f;-webkit-border-radius:5px 5px 5px 5px;-moz-border-radius:5px;border-radius:5px 5px 5px 5px;padding:5px;}
            .hdot{height:1px;border-top:1px dotted #dbdbdb;}
            /* Tabbed interface */
            .container {width: 670px; margin: 10px auto;}
            ul.tabs {margin: 0;padding: 0;float: left;list-style: none;height: 32px;border-bottom: 1px solid #c0c0c0;border-left: 1px solid #c0c0c0;width: 100%;}
            ul.tabs li {float: left;margin: 0;padding: 0;height: 31px;line-height: 31px;border: 1px solid #c0c0c0;border-left: none;margin-bottom: -1px;background: #e0e0e0;overflow: hidden;position: relative;}
            ul.tabs li a {text-decoration: none;color: #000;display: block;padding: 0 20px;border: 1px solid #fff;outline: none;}
            ul.tabs li a:hover {background: #ccc;}	
            html ul.tabs li.active, html ul.tabs li.active a:hover  {background: #fff;border-bottom: 1px solid #fff;}
            .tab_container {	border: 1px solid #c0c0c0;border-top: none;clear: both;float: left; width: 100%;background: #fff;
                             -webkit-border-radius: 0px 0px 5px 5px;-moz-border-radius: 0px 0px 5px 5px;border-radius: 0px 0px 5px 5px;}
            .tab_content {padding: 20px;}
            .tab_content h2 {padding-bottom: 10px;border-bottom: 1px dotted #ddd;}
            .tab_content h3 a{color: #254588;}
            /* Google map */
            #map_canvas {width: 630px; height: 400px;border:1px solid #dbdbdb;}
            -->
        </style>
    </head>
    <body>
        <div class="container">
            <h1>Simple Jquery CSS Tabs and V3 Google Maps</h1>

            <ul class="tabs">
                <li><a href="#tab1">About</a></li>
                <li><a href="#tab2" id="showMap">Map</a></li>
                <li><a href="#tab3">Contact</a></li>
            </ul>
            <!-- Start tab container -->
            <div class="tab_container">

                <div id="tab1" class="tab_content">
                    <h2>About</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                </div>

                <div id="tab2" class="tab_content">
                    <h2>Google Map</h2>
                    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
                    <script type="text/javascript" language="javascript">
                                //<![CDATA[
                                $(document).ready(function() {

                            function initialize() {
                                var myLatlng = new google.maps.LatLng(-31.952222, 115.858889);
                                var myOptions = {
                                    zoom: 14,
                                    center: myLatlng,
                                    mapTypeId: google.maps.MapTypeId.ROADMAP
                                }

                                var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

                                var contentString = '<div id="content">' +
                                        '<h1>Perth, Western Australia</h1>' +
                                        '<div>' +
                                        '<p><b>Perth</b> is the capital and largest city of the Australian state of Western Australia and the fourth most populous city in Australia</p>' +
                                        '<p>Attribution: Perth, Western Australia, <a href="http://en.wikipedia.org/wiki/Perth,_Western_Australia">' +
                                        'http://en.wikipedia.org/wiki/Perth,_Western_Australia</a></p>' +
                                        '</div>' +
                                        '</div>';

                                var infowindow = new google.maps.InfoWindow({
                                    content: contentString,
                                    maxWidth: 300
                                });

                                var marker = new google.maps.Marker({
                                    position: myLatlng,
                                    map: map,
                                    title: 'Perth, Western Australia'
                                });
                                google.maps.event.addListener(marker, 'click', function() {
                                    infowindow.open(map, marker);
                                });

                            }
                            // Function added to help reset map and container boundaries
                            $("#showMap").click(function() {
                                $("#tab2").css({'display': 'block'});
                                $("#map_canvas").css({'width': '630px', 'height': '400px'});
                                initialize();
                                //alert('showMap Clicked!');
                            });

                            initialize();

                        });
                                //]]>
                    </script>
                    <div id="map_canvas" style="width:630px;height:400px;"></div>
                </div>

                <div id="tab3" class="tab_content">
                    <h2>Contact</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                    </p>
                </div>

            </div>
            <!-- End tab container -->

            <!-- Back Home Footer -->
            <div style="clear: both; display: block; padding: 10px 0; text-align:center;">
                <div class="backtohome">
                    <p><a href="http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery">Simple Tabs w/ CSS &amp; jQuery</a> by Soh Tanaka. | 
                        <a href="http://flintmaker.com">&laquo; Back to Flintmaker</a>
                    </p>
                </div>
            </div>
            <!-- end back home Footer -->
        </div>
    </body>
</html>